<template>
  <div id='reg_login'>
    <div id='login_box'>
        <div class='login_top'>
            <p class='arrow_p'><span class='arrow1'> </span></p>
            <p class='login_p'>京东登录</p>
        </div>
        <div class='wrap loginPage'>
            <div class='input-container'>
                <label class="area-box">
                    <span class="area_code" code="86">+86</span>
                    <i class="area_icon"></i>
                </label>
                <input id="phone" class="acc-input phone txt-input J_ping" type="text" value="" placeholder="用户名/邮箱/已验证手机">
                 <div class='icon icon-clear' @click='clear()'></div>
            </div>
        </div>    
         <div id='loginOneStep'  @click='login()'>
                <img src='/static/init.gif'>
                <p>点击完成验证</p>
        </div>
        <div id='msgphone11' class='msgphone122'><span class='msgphone12'>{{msgphone}}</span></div>
    </div>
  </div>
</template>
<script>
export default {
  //背景色#f7f7f7
  beforeCreate() {
    document
      .querySelector("body")
      .setAttribute("style", "background-color:#f7f7f7");
  },
  data(){
    return {
      formLoginData: {
        username: "",
        password: "",
      },
      msgphone:'',
    };
  },
  //清除手机号
  methods:{
    clear() {
      this.$jq("#phone")
        .hide()
        .val("请输入手机号")
        .show()
        .focus();
      this.$jq("#phone")
        .focus()
        .val("");
        this.$jq('#msgphone11').removeClass('msgphone123')
    },
     login() {
       this.$jq('#msgphone11').addClass('msgphone123')
      var phoneReg= /^1[3689]{1}\d{9}$/ // 手机号码
      var value = this.$jq("#password").val();
      var phonevalue = this.$jq("#phone").val();
      if (this.phonevalue == "") {
        this.msgphone = "用户名不能为空";
      var value = this.$jq("#password").val();
      } else if (!phoneReg.test(phonevalue)) {
        this.msgphone = "用户名不存在";
      } else {
        this.msgphone = "用户名正确";
      }

    }
  }
};
</script>
<style scoped>
body {
  background-color: #f7f7f7;
  margin: 0;
  padding: 0;
}
#reg_login {
  background-color: #f7f7f7;
}
#login_box {
  font-size: 0.96rem;
  background-color: #f7f7f7;
}
#phone{
  outline: none;
  border: 0;
}
#msgphone{
  width:20%;
}
p {
  margin: 0;
  padding: 0;
}
.login_top {
  height: 2.75rem;
  line-height: 2.75rem;
  background: #f9f9f9;
  color: #616161;
  font-size: 1.17rem;
  border-bottom: 1px solid #bbb;
  z-index: 999;
  display: flex;
  justify-content: space-between;
  width: 100%;
}
.login_p {
  width: 60%;
}
.arrow_p {
  width: 40%;
  position: relative;
}
.arrow1 {
  width: 1.375rem;
  height: 1.375rem;
  overflow: hidden;
  position: absolute;
  background-image: url(/static/iconBg.png);
  background-repeat: no-repeat;
  background-size: cover;
  display: inline-block;
  background-position: 0rem -4rem;
  line-height: 2.75rem;
  top: 35%;
}
.loginPage {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.wrap {
  width: 100%;
}
.input-container {
  width: 90%;
  margin: 2rem auto 2rem;
  display: flex;
  justify-content: space-between;
  border-bottom: 0.1rem solid #d7d7d7;
  padding: 0.4rem 0;
  background: #fff;
}
.txt-username {
  width: 20%;
}
.area-box {
  display: flex;
  justify-content: space-between;
  position: relative;
}
.area_code {
  padding: 0.5rem 1rem;
  width: 80%;
}
.area_icon {
  width: 0;
  height: 0;
  border-left: 0.3rem solid transparent;
  border-right: 0.3rem solid transparent;
  border-top: 0.4rem solid #ababab;
  display: inline-block;
  position: absolute;
  right: 0.2rem;
  top: 45%;
}
#username {
  width: 80%;
  border: 0;
  color: #848689;
  outline: none;
}
::-webkit-input-placeholder {
  color: #bec1c7;
}
.icon-clear {
  background: url(/static/iconBg.png) no-repeat;
  width: 1.4rem;
  height: 1.4rem;
  background-size: cover;
  margin-right: 0.8rem;
  margin-top: 0.6rem;
  /* display: none; */
}
#loginOneStep {
  width: 90%;
  margin: auto;
  text-align: left;
  line-height: 2.76rem;
  background: #fff;
  color: #409eff;
  border: 0.1rem solid #409eff;
  font-size: 0.875rem;
  display: flex;
  justify-content: space-between;
}
#loginOneStep > img {
  height: 1.375rem;
  width: 6%;
  margin: auto 0.5rem;
}
#loginOneStep > p {
  width: 94%;
}
#msgphone11{
  background: #2B2B2B;
  border-radius: 3px;
  transition: all .3s ease;
  color: #fff;
  padding:1rem;
  font-size:0.8rem;
  margin:3rem  auto 0;
  width:40%;
  text-align: center;
}
.msgphone122{
  display: none
}
.msgphone123{
  display: block
}
</style>


